package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.Date;
@Getter
@Setter
public class TogetherTrip extends BaseDomain{
    public static final Integer CONSUME_LOW = 0;   // 穷游
    public static final Integer CONSUME_COMMON = 1;     // 普通
    public static final Integer CONSUME_MEDIUM = 2;     // 中等
    public static final Integer CONSUME_HIGH = 3;     // 高级

    private String coverUrl;

    private String title;

    private User author;

    private Region region;
   @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
   @DateTimeFormat(pattern ="yyyy-MM-dd")
   private Date goTime;

    private Integer days;

    private Integer consumeLevel =1;
    //旅游人数
    private Integer person;
    //关注的人数
    private Integer collectionNum;
    //收藏的人数
    private Integer applyNum;

    private String intro;

    private Boolean state = true;//默认发布
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date releaseTime;


    private TogetherContent content;

    public String getTravelDays(){

        return days+" 天左右";
    }
    public String getGoTimeStr(){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月-dd日");
        String format = sdf.format(goTime);
        return (format+" 出发").substring(5);

    }


    public String getConsumeName() {
        String temp = "普通";
        if (consumeLevel == 0) {
            temp = "穷游";
        } else if (consumeLevel == 2) {
            temp = "中等";
        } else if (consumeLevel == 3) {
            temp = "高级";
        }
        return temp;
    }


}